<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EOS.IO: contracts/storage/storage.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EOS.IO
   &#160;<span id="projectnumber">DAWN3.0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_ae9b15dd87e066e1908bbd90e8f38627.html">contracts</a></li><li class="navelem"><a class="el" href="dir_322cd3c97a9c45f1dd8d138b04e20992.html">storage</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">storage.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="storage_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="eos_8hpp.html">eoslib/eos.hpp</a>&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="token_8hpp.html">eoslib/token.hpp</a>&gt;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="db_8hpp.html">eoslib/db.hpp</a>&gt;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#ifndef TOKEN_NAME</span></div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="storage_8hpp.html#a2bf6bf152ba93be8cace72c5d55abc71">   20</a></span>&#160;<span class="preprocessor">#define TOKEN_NAME TOK</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_t_o_k_e_n___n_a_m_e.html">TOKEN_NAME</a> {</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga86efb13cee9fb81541e1b4d92617b68f">   36</a></span>&#160;    <span class="keyword">typedef</span> <a class="code" href="structeosio_1_1token.html">eosio::token&lt;uint64_t, N(storage)&gt;</a> <a class="code" href="group__storageapi.html#ga86efb13cee9fb81541e1b4d92617b68f">storage_tokens</a>;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="struct_t_o_k_e_n___n_a_m_e_1_1transfer.html">   43</a></span>&#160;   <span class="keyword">struct </span><a class="code" href="struct_t_o_k_e_n___n_a_m_e_1_1transfer.html">transfer</a> {</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="group__storageapi.html#gae2c79dd22a28b60c9800efa35c515e22">   47</a></span>&#160;        <a class="code" href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a> <a class="code" href="group__storageapi.html#gae2c79dd22a28b60c9800efa35c515e22">from</a>;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;</div><div class="line"><a name="l00052"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga2465adec996f6c6bf45f450043b45c95">   52</a></span>&#160;        <a class="code" href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a> <a class="code" href="group__storageapi.html#ga2465adec996f6c6bf45f450043b45c95">to</a>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="group__storageapi.html#gaa19dbd7b8beace25c91d274519166a37">   57</a></span>&#160;        storage_tokens <a class="code" href="group__storageapi.html#gaa19dbd7b8beace25c91d274519166a37">quantity</a>;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;   };</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga91c727f2c7563c091d098f5e97d4d071">   63</a></span>&#160;   <span class="keyword">struct </span>PACKED(account) {</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;      <a class="code" href="structaccount.html">account</a>( storage_tokens b = <a class="code" href="group__storageapi.html#ga86efb13cee9fb81541e1b4d92617b68f">storage_tokens</a>() ):balance(b),quotaused(0){}</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;      <span class="keyword">const</span> <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> key = <a class="code" href="group__types.html#gaf9c1edb0e0da55ec6ba09f32f6839529">N</a>(<a class="code" href="structaccount.html">account</a>);</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;      storage_tokens balance;</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;      <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> quotaused;</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;      <span class="keywordtype">bool</span>  is_empty()<span class="keyword">const  </span>{ <span class="keywordflow">return</span> balance.<a class="code" href="structeosio_1_1token.html#a41378f3d965a9e6a3b2c9be37c132b2f">quantity</a> == 0 &amp;&amp; quotaused == 0; }</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;   };</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;   static_assert( <span class="keyword">sizeof</span>(<a class="code" href="structaccount.html">account</a>) == <span class="keyword">sizeof</span>(<a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a>)+<span class="keyword">sizeof</span>(storage_tokens)+<span class="keyword">sizeof</span>(<a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a>), <span class="stringliteral">&quot;unexpected packing&quot;</span> );</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div><div class="line"><a name="l00098"></a><span class="lineno"><a class="line" href="group__storageapi.html#gadb8b8fed67974b71f01e447297223754">   98</a></span>&#160;   <span class="keyword">using</span> <a class="code" href="structeosio_1_1table.html">accounts</a> = <a class="code" href="structeosio_1_1table.html">eosio::table&lt;N(storage),N(storage),N(account),account,uint64_t&gt;</a>;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;</div><div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga0f5c38cd82e9e2d628b89620695ee1f6">  111</a></span>&#160;   <span class="keyword">inline</span> <a class="code" href="structaccount.html">account</a> <a class="code" href="group__storageapi.html#ga0f5c38cd82e9e2d628b89620695ee1f6">get_account</a>( <a class="code" href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a> owner ) {</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;      <a class="code" href="structaccount.html">account</a> owned_account;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;      <a class="code" href="structeosio_1_1table.html#aa21c1502397afb2cd3952e799fc391c0">accounts::get</a>( owned_account, owner );</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;      <span class="keywordflow">return</span> owned_account;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;   }</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga1b41f02233d1ea7de04e16fdeedd987d">  124</a></span>&#160;   <span class="keyword">inline</span> <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> <a class="code" href="group__storageapi.html#ga1b41f02233d1ea7de04e16fdeedd987d">get_quota_used</a>( <a class="code" href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a> owner ) {</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;      <a class="code" href="structaccount.html">account</a> owned_account;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;      <a class="code" href="structeosio_1_1table.html#aa21c1502397afb2cd3952e799fc391c0">accounts::get</a>( owned_account, owner );</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;      <span class="keywordflow">return</span> owned_account.quotaused;</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;   }</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno"><a class="line" href="group__storageapi.html#ga6fd7e68a6bf71a5a78dc2ff7047e8f62">  133</a></span>&#160;  <span class="keyword">struct </span><a class="code" href="group__storageapi.html#ga91c727f2c7563c091d098f5e97d4d071">PACKED</a>( link ) {</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;      <a class="code" href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a> owner;</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;      <span class="keywordtype">char</span>* eospath;</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;      </div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;      <span class="keywordtype">char</span>* ipfspath;</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;      <a class="code" href="group__types.html#ga06896e8c53f721507066c079052171f8">uint32_t</a> size;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;      <a class="code" href="group__types.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> store;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;      <a class="code" href="group__types.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> accept;</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;      <a class="code" href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a> stake;</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;      <a class="code" href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a> producer;</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;  };</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;} </div><div class="ttc" id="group__types_html_gaba7bc1797add20fe3efdf37ced1182c5"><div class="ttname"><a href="group__types.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a></div><div class="ttdeci">unsigned char uint8_t</div><div class="ttdef"><b>Definition:</b> types.h:21</div></div>
<div class="ttc" id="group__storageapi_html_ga0f5c38cd82e9e2d628b89620695ee1f6"><div class="ttname"><a href="group__storageapi.html#ga0f5c38cd82e9e2d628b89620695ee1f6">TOKEN_NAME::get_account</a></div><div class="ttdeci">account get_account(account_name owner)</div><div class="ttdef"><b>Definition:</b> storage.hpp:111</div></div>
<div class="ttc" id="group__storageapi_html_ga86efb13cee9fb81541e1b4d92617b68f"><div class="ttname"><a href="group__storageapi.html#ga86efb13cee9fb81541e1b4d92617b68f">TOKEN_NAME::storage_tokens</a></div><div class="ttdeci">eosio::token&lt; uint64_t, N(storage)&gt; storage_tokens</div><div class="ttdef"><b>Definition:</b> storage.hpp:36</div></div>
<div class="ttc" id="group__types_html_gaf9c1edb0e0da55ec6ba09f32f6839529"><div class="ttname"><a href="group__types.html#gaf9c1edb0e0da55ec6ba09f32f6839529">N</a></div><div class="ttdeci">#define N(X)</div><div class="ttdoc">used to generate a compile time uint64_t from the base32 encoded string interpretation of X ...</div><div class="ttdef"><b>Definition:</b> types.hpp:62</div></div>
<div class="ttc" id="struct_t_o_k_e_n___n_a_m_e_1_1transfer_html"><div class="ttname"><a href="struct_t_o_k_e_n___n_a_m_e_1_1transfer.html">TOKEN_NAME::transfer</a></div><div class="ttdef"><b>Definition:</b> storage.hpp:43</div></div>
<div class="ttc" id="structaccount_html"><div class="ttname"><a href="structaccount.html">account</a></div><div class="ttdef"><b>Definition:</b> social.cpp:43</div></div>
<div class="ttc" id="group__storageapi_html_gae2c79dd22a28b60c9800efa35c515e22"><div class="ttname"><a href="group__storageapi.html#gae2c79dd22a28b60c9800efa35c515e22">TOKEN_NAME::transfer::from</a></div><div class="ttdeci">account_name from</div><div class="ttdef"><b>Definition:</b> storage.hpp:47</div></div>
<div class="ttc" id="group__types_html_ga3b44deb4b3b8d6ebab339d1263692117"><div class="ttname"><a href="group__types.html#ga3b44deb4b3b8d6ebab339d1263692117">account_name</a></div><div class="ttdeci">uint64_t account_name</div><div class="ttdef"><b>Definition:</b> types.h:35</div></div>
<div class="ttc" id="group__types_html_gaaa5d1cd013383c889537491c3cfd9aad"><div class="ttname"><a href="group__types.html#gaaa5d1cd013383c889537491c3cfd9aad">uint64_t</a></div><div class="ttdeci">unsigned long long uint64_t</div><div class="ttdef"><b>Definition:</b> types.h:18</div></div>
<div class="ttc" id="token_8hpp_html"><div class="ttname"><a href="token_8hpp.html">token.hpp</a></div><div class="ttdoc">Defines types and ABI for standard token messages and database tables. </div></div>
<div class="ttc" id="group__storageapi_html_gaa19dbd7b8beace25c91d274519166a37"><div class="ttname"><a href="group__storageapi.html#gaa19dbd7b8beace25c91d274519166a37">TOKEN_NAME::transfer::quantity</a></div><div class="ttdeci">storage_tokens quantity</div><div class="ttdef"><b>Definition:</b> storage.hpp:57</div></div>
<div class="ttc" id="structeosio_1_1token_html"><div class="ttname"><a href="structeosio_1_1token.html">eosio::token&lt; uint64_t, N(storage)&gt;</a></div></div>
<div class="ttc" id="eos_8hpp_html"><div class="ttname"><a href="eos_8hpp.html">eos.hpp</a></div></div>
<div class="ttc" id="structeosio_1_1token_html_a41378f3d965a9e6a3b2c9be37c132b2f"><div class="ttname"><a href="structeosio_1_1token.html#a41378f3d965a9e6a3b2c9be37c132b2f">eosio::token::quantity</a></div><div class="ttdeci">NumberType quantity</div><div class="ttdoc">Quantity of tokens available. </div><div class="ttdef"><b>Definition:</b> token.hpp:58</div></div>
<div class="ttc" id="group__types_html_ga06896e8c53f721507066c079052171f8"><div class="ttname"><a href="group__types.html#ga06896e8c53f721507066c079052171f8">uint32_t</a></div><div class="ttdeci">unsigned long uint32_t</div><div class="ttdef"><b>Definition:</b> types.h:19</div></div>
<div class="ttc" id="namespace_t_o_k_e_n___n_a_m_e_html"><div class="ttname"><a href="namespace_t_o_k_e_n___n_a_m_e.html">TOKEN_NAME</a></div><div class="ttdef"><b>Definition:</b> storage.cpp:7</div></div>
<div class="ttc" id="group__storageapi_html_ga91c727f2c7563c091d098f5e97d4d071"><div class="ttname"><a href="group__storageapi.html#ga91c727f2c7563c091d098f5e97d4d071">TOKEN_NAME::PACKED</a></div><div class="ttdeci">struct PACKED(account)</div><div class="ttdoc">row in account table stored within each scope </div><div class="ttdef"><b>Definition:</b> storage.hpp:63</div></div>
<div class="ttc" id="db_8hpp_html"><div class="ttname"><a href="db_8hpp.html">db.hpp</a></div></div>
<div class="ttc" id="group__storageapi_html_ga1b41f02233d1ea7de04e16fdeedd987d"><div class="ttname"><a href="group__storageapi.html#ga1b41f02233d1ea7de04e16fdeedd987d">TOKEN_NAME::get_quota_used</a></div><div class="ttdeci">uint64_t get_quota_used(account_name owner)</div><div class="ttdef"><b>Definition:</b> storage.hpp:124</div></div>
<div class="ttc" id="structeosio_1_1table_html"><div class="ttname"><a href="structeosio_1_1table.html">eosio::table</a></div><div class="ttdef"><b>Definition:</b> db.hpp:179</div></div>
<div class="ttc" id="structeosio_1_1table_html_aa21c1502397afb2cd3952e799fc391c0"><div class="ttname"><a href="structeosio_1_1table.html#aa21c1502397afb2cd3952e799fc391c0">eosio::table::get</a></div><div class="ttdeci">static bool get(const PrimaryType &amp;p, Record &amp;r, uint64_t s=scope)</div><div class="ttdoc">Fetches a record from the table. </div><div class="ttdef"><b>Definition:</b> db.hpp:377</div></div>
<div class="ttc" id="group__storageapi_html_ga2465adec996f6c6bf45f450043b45c95"><div class="ttname"><a href="group__storageapi.html#ga2465adec996f6c6bf45f450043b45c95">TOKEN_NAME::transfer::to</a></div><div class="ttdeci">account_name to</div><div class="ttdef"><b>Definition:</b> storage.hpp:52</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
